package com.yb.guigu.pick.activity.controller;

import com.yb.guigu.pick.activity.endpoint.WebSocketEndpoint;
import com.yb.guigu.pick.core.bean.GuiguResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Copyright (C), 2022-2023, 姚兵
 * Author: 32210
 * Date: 2023/7/16 13:32
 * FileName: WebsocketController
 * Description:
 */

@RestController
@RequestMapping("websocket_send")
public class WebsocketController {


    @Autowired
    WebSocketEndpoint webSocketEndpoint;

    @RequestMapping("to_user/{userId}")
    public GuiguResult sendTo(@PathVariable String userId){

        webSocketEndpoint.sendMsgByUserId(userId,"hello "+userId);

        return GuiguResult.success();
    }
}
